import { Component, OnInit } from '@angular/core';
import { NzMessageService } from 'ng-zorro-antd';
import { ComponentBasic } from '../../app.component';
import { RoleRight } from '../../../kalend';
import { MerchanthistoryService } from 'src/app/service/merchanthistory.service';
@Component({
  selector: 'app-merchantinfo',
  templateUrl: './merchantorderrecord.component.html',
  styleUrls: ['./merchantorderrecord.component.scss'],
  providers: [MerchanthistoryService]
})
export class MerchantorderrecordComponent extends ComponentBasic implements OnInit {
  user: any = RoleRight.getStorage();
  mid = RoleRight.getStorage().merchantid;
  loading = true;
  pageIndex = 1;
  pageSize = 15;
  total = 1;
  dataSet = [];
  paystatus: any;
  sdate: any;
  edate: any;
  footTotal: any;
  constructor(private service: MerchanthistoryService, private msg: NzMessageService) {
    super();
    super.setLayout(true, true);
  }

  ngOnInit() {
    this.searchData();
  }
  searchData(reset: boolean = false): void {
    this.loading = true;
    this.service.query({
      offset: this.pageIndex,
      limit: this.pageSize,
      mid: this.mid,
      starttime: this.sdate,
      endtime: this.edate
    }).then((res) => {
      this.loading = false;
      this.total = res.total;
      this.dataSet = res.rows;
      this.footTotal = res.footTotal; // 如: 共计 1200 元，酒币 2000 个，餐币 150 个
    });
  }
}
